package DB;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import objects.User;


@Entity
@Table(name="Friends")
public class UserFriends
{
	@Id
	private FriendPK friendPK = new FriendPK();
	
	
	public User getFreind()
	{
		return friendPK.getFriend();
	}

	public void setFriend(User friend)
	{
		this.friendPK.setFriend(friend);
	}
	
	public User getUser(){
		return this.friendPK.getUser();
	}
	
	public void setUser(User user){
		this.friendPK.setUser(user);
	}
	
	
	@Embeddable 
	private static class FriendPK implements Serializable
	{
		@ManyToOne
		private User friend;
		@ManyToOne
		private User user;
		
		public User getFriend()
		{
			return friend;
		}

		public void setFriend(User friend)
		{
			this.friend = friend;
		}
		
		public User getUser(){
			return this.user;
		}
		
		public void setUser(User user){
			this.user = user;
		}
		
	}
	
}
